
const server = require('server.js');

let dataBeforeHandle=function(data){

}

module.exports = {
  requestTimeout(fff,uri,method,data,success){
    console.log(fff);
    let headers={"TToken":server.getUserToken().token};
    wx.request({url:server.baseUrl+uri,method:method,header:headers,data:data,success:(d)=>{
      success(d.data)
    },fail:fff,
    timeout:3000});
  },
  request(uri,method,data,success,fail){
    let headers={"TToken":server.getUserToken().token};
    wx.request({url:server.baseUrl+uri,method:method,header:headers,data:data,success:(d)=>{
      success(d.data)
    },fail:fail});
  },
  get(uri,data){
    return new Promise(function(resolve,reject){
      let headers={"TToken":server.getUserToken().token};
      wx.request({
        url: server.baseUrl+uri,method:'get',header:headers,data:data,success:function(res){
          resolve(res.data);
        }
      })
    })
  },
  upload(){
  }
}